﻿using IXION.BLOG.DOMAIN.BLOG;
using IXION.BLOG.SERVICE.COMMON;
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IXION.BLOG.WEB.UI.UserControl
{
    /// <summary>
    /// 音乐播放器控件
    /// </summary>
    public partial class Music : System.Web.UI.UserControl
    {
        public string musicSource;
        public IList<Mp3> mp3s;
        protected CommonService service = new CommonService();
        protected void Page_Load(object sender, EventArgs e)
        {
            mp3s = service.LoadMp3s();
            musicSource = GetMp3Source();
        }

        private string GetMp3Source()
        {
            string target = "";
            if (mp3s == null || mp3s.Count == 0)
            {
                return target;
            }
            foreach (Mp3 mp3 in mp3s)
            {
                target += mp3.Name + ":" + mp3.Path + ";";
            }
            return target.Remove(target.Length - 1);
        }

        //protected void Next_ServerClick(object sender, EventArgs e)
        //{
        //    this.musicSource = "一生有你:/mp3/ysyn.mp3";
        //}

        //protected void PreButton_Click(object sender, EventArgs e)
        //{
        //    this.musicSource = "谁叫你是男人呢:/mp3/sjnsnrn.mp3;一生有你:/mp3/ysyn.mp3";
        //}
    }
}